<?php

namespace App\Dmeo;


use App\Common\Comiter;

use App\Models\ShopType;
use Illuminate\Http\Request;

class ShopTypeDao
{
    /**
     * Name:分页展示
     * User: yangrui
     * Date: 2023/6/17
     * Time:8:18
     * @param $num
     * @return \Exception
     */
    public static function ShopTypeList($num,$search){
        try {
            //$search(搜索的条件)
            return  ShopType::list($num,$search)->toArray();
        }catch (\Exception $e){
            return $e;
        }
    }

    /**
     * Name:删除
     * User: yangrui
     * Date: 2023/6/17
     * Time:11:22
     * @param $id
     * @param $status
     * @param $pid
     * @return \Exception|int|void
     */

    public static function ShopTypeDel($id,$status,$pid){
        try {
            //状态为0 或 有没有子集可删
            if($status == 0 || $pid!==$id){
                $data=ShopType::del($id);
                return $data;
            }
        }catch (\Exception $e){
            return $e;
        }
    }
    public static function ShopTypeCreate($data){
        try {
            $data=ShopType::create($data);
            return $data;
        }catch (\Exception $e){
            return $e;
        }
    }

}
